#include<bits/stdc++.h>
using namespace std;
int n,mon_max,weak,ans,hp,mon[100001];
main(){
    freopen("duel2.in","r",stdin);
    freopen("duel2.out","w",stdout);
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>hp;
        mon[hp]++;
    }
    weak=mon[0];
    for(int i=1;i<100000;i++){
        int dif=abs(weak-mon[i]);
        if(mon[i]<=weak){
            ans+=mon[i];
        }else{
            ans+=weak;
            weak=mon[i];
        }
    }
    ans=n-ans;
    cout<<ans;
}
